package com.demon.auto.model.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 分页信息
 *
 * @version 1.0
 * @author huangrz
 * @date 2025/02/20 15:24
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PageVo<T> extends Page<T> {

    private long page = 1L;
    private long pageSize = 10L;

    public PageVo() {
        this.current = this.page;
        this.size = this.pageSize;
    }

    public PageVo(long page, long pageSize) {
        this.page = page;
        this.current = page;
        this.pageSize = pageSize;
        this.size = pageSize;
    }

    public void setPage(long page) {
        this.page = page;
        this.current = page;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
        this.size = pageSize;
    }

    @Override
    public long getCurrent() {
        return this.getPage();
    }

    @Override
    public long getSize() {
        return this.getPageSize();
    }

    @Override
    public Page<T> setCurrent(long current) {
        this.page = current;
        return super.setCurrent(current);
    }

    @Override
    public Page<T> setSize(long size) {
        this.pageSize = size;
        return super.setSize(size);
    }

}
